<template>
	<view>
		<view class="box"  v-for="(item,index) in ytlist" :key="index">
			<view class="box1">
				<image :src="item.picture"></image>
				<text class="box1_zi">{{$t('flow.boda')}}{{item.orderMethod}}</text>
			</view>
			<view class="box2">
				<view class="box2_zi">免流量</view>
				<view class="box2_zi2">{{item.price}}{{$t('app.kips')}}</view>
				<view><text class="box2_zi3">{{item.day}}</text>{{$t('app.ri')}}</view>
			<u-button type="defalut"  size="mini" :text="$t('buymusic.buy')" color=" #1eb9ee" style="height: 40px;" @click="buyyt(item.id,item.comboName)"></u-button>
			</view>
		</view>
	</view>
</template>

<script>
	import { getResponseData, showToastTip,getBaseUrl,getWsUrl} from "@/api/req.js";
	export default {
		data() {
			return {
                  ytlist:[]
			}
		},
		onLoad() {
			var that = this;
			// 得到用户数据
			getResponseData("/combo/getComboByType", 'get',{
				type:5
			}, function(res) {
				if (res.code == 200) {
					console.log(res);
					that.ytlist = res.data;
				}else{
					uni.showToast({
						title: res.msg,
						icon: 'none',
						duration: 2000
					})
				}
			});
		},
		methods: {
              buyyt(d,name){
				  uni.showModal({
				  	title: this.$t('buywifi.buy'),
				  	content: this.$t('flow.buy')+ name + '？',
					confirmText:this.$t('app.qd'),
					cancelText:this.$t('app.qx'),
				  	success: function(res) {
				  		if (res.confirm) {
				  		     getResponseData("/combo/buyCombo"
				  		     , 'get',{
				  		     	id:d
				  		     }, function(res) {
				  		     	// console.log(res.data);
				  				if(res.code){
				  					uni.showToast({
				  						title: res.msg,
				  						icon: 'none',
				  						duration: 2000
				  					})
				  				}
				  		     	
				  		     });
				  		} else {
				  			
				  		}
				  	}
				  })
			  }
		}
	}
</script>

<style>
	page {
		background-color: ghostwhite;
	}

	.box {
		display: flex;
		width: 90%;
		margin: auto;
		margin-top: 20px;
		background-color: white;
		padding: 10px;
		border-radius: 10px;
	}

	.box1 {
		width: 45%;
		display: flex;
		flex-wrap: wrap;
		/* border: 1px red solid; */
	}

	.box1_zi {
		margin: auto;
		line-height: 35px;
	}

	image {
		width: 80px;
		height: 80px;
		border-radius: 20px;
		margin: auto;
	}
	,.box2{
		width: 50%;
		text-align: center;
	}

	.box2_zi {
		/* text-decoration: line-through; */
		font-size: 16px;
		color: gray;
		line-height: 30px;

	}

	.box2_zi2 {
		font-size: 18px;
		line-height: 30px;
	}
	
	.box2_zi3{
		font-size: 25px;
		line-height: 30px;
	}
</style>